package books.to.africa


import grails.test.ControllerUnitTestCase
import grails.test.mixin.*
import org.junit.*

/**
 * See the API for {@link grails.test.mixin.web.ControllerUnitTestMixin} for usage instructions
 */
@TestFor(DonorRestController)
class DonorRestControllerTests extends ControllerUnitTestCase {

	Date createDate = new Date()
protected void setUp(){
	super.setUp()
	mockDomain (DonorRegister,
			[new DonorRegister (dateCreated: createDate,dl: null,username: "bob", password: "bob", email: "bob@awesome.com")]
		)

}
	
    void testShow() {
	  this.controller.params.id = 1
	 this.controller.show()
	def responseContent = this.controller.response.contentAsString
		def xml = new XMLSlurper().parseText(responseContent)
	
	assertEquals createDate + "null bob bob bob@awesome.com", xml.content.text()  
	
    }
}
